<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //总订单表
        Schema::create('orders', function (Blueprint $table) {
            $table->increments('id')->comment('自增id');
            $table->integer('user_id')->default(0)->comment('用户id');
            $table->integer('activity_id')->default(0)->comment('活动id');
            $table->string('order_num')->unique()->comment('订单编号');
            $table->decimal('m_amount')->default(0)->comment('订单原总额');
            $table->decimal('s_amount')->default(0)->comment('订单实际总额');
            $table->integer('is_pay')->default(0)->comment('是否已支付，0：未支付，1：已支付');
            $table->timestamp('pay_time')->nullable()->comment('支付时间');
            $table->string('pay_type')->nullable()->comment('支付方式，有weixin、alipay、bank');
            $table->string('note')->nullable()->comment('备注');
            $table->integer('status')->default(0)->comment('订单状态');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
